//
//  CommodityCommentViewController.m
//  DuBai
//
//  Created by darktm on 14-3-18.
//  Copyright (c) 2014年 darktm. All rights reserved.
//

#import "CommodityCommentViewController.h"

#import "TaskWithAddGoodsComments.h"

@interface CommodityCommentViewController ()<WYHttpTaskDelegate>

@end

@implementation CommodityCommentViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.commitBtn.layer.cornerRadius = 13.0f;
    
    
    self.txt.layer.borderColor = [[[UIColor darkTextColor] colorWithAlphaComponent:.2] CGColor];
    self.txt.layer.borderWidth = 1.0f;
    
    self.txt.layer.cornerRadius = 8.0f;
    
    self.txt.placeholder = @"您的评论";
    self.txt.placeholderColor = [[UIColor darkTextColor] colorWithAlphaComponent:.4];
//    [self.txt becomeFirstResponder];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(void)requestCompleteWithObj:(WYHttpTask *)obj{
    
    [MBProgressHUD hideHUDForView:self.view animated:YES];
    id rsult = [obj parese];
    
    if([obj isKindOfClass:[TaskWithAddGoodsComments class]]){
        [self.navigationController popViewControllerAnimated:YES];
    }
}
-(void)requestFailWithMsg:(WYHttpTask *)obj{
    [MBProgressHUD hideHUDForView:self.view animated:YES];
    DLog(@"%@",obj.networkOp.url);
}
- (IBAction)on_btn_commit:(id)sender {
    [MBProgressHUD showHUDAddedTo:self.view animated:YES];
    TaskWithAddGoodsComments *comment = [[TaskWithAddGoodsComments alloc] init];
    comment.goodid = @"5309b0bc2e2f940cec0041a9";
    comment.desc = self.txt.text;
    comment.grade = @"2";
    comment.delegate = self;
    [comment start];
}
@end
